<?php
use Fuel\Core\Input;

use Fuel\Core\Controller_Rest;

use Fuel\Core\Controller_Template;

use Fuel\Core\View;

use Fuel\Core\Controller;

class  Controller_Posts extends Controller_Rest
{
	public function before()
	{
		parent::before(); // Without this line, templating won't work!
	
		// do stuff
	}
	
	/**
	 * Make after() compatible with Controller_Template by adding $response as a parameter
	 */
	public function after($response)
	{
		$response = parent::after($response); // not needed if you create your own response object
	
		// do stuff
	
		return $response; // make sure after() returns the response object
	}
	
	//list posts/*
	
	public function get_index($id)
	{
	
	
		
		/*
		 *  $view = View::forge('home/index');

        //assign variables for the view
        $view->username = 'Joe14';
        $view->title = 'Home';

        //another way to assign variables for the view
        $view->set('username', 'Joe14');
        $view->set('title', 'Home');

        //assign the view to browser output
        return $view;
		 
	
	
	//	$query = DB::query('SELECT * from posts');
	//	$result = $query->execute();
	//	$data['posts']= $result->as_array();
	//	$data['username'] = 'Joe14';
      //  $data['title'] = 'Home';
	//	$this->template->title = 'Example Page';
		//$this->template->content="Tran Thanh An";
	//	$this->template->content = View::forge('test', $data);
	 * */
	 
	$array=array("id"=>$id,"name"=>"gao");
	
		return $array;
	}
	function action_all()
	{
		return $this->response(array(
            'id' => Input::get("foo"),
				
            'baz' => array(
                1, 50, 219
            ),
            'empty' => null
        ));
	}
	
	
	
}
?>